window.addEvent('domready', function(){
   // alert("voy a llamar"+$('tabsProyecto-nav'));
    if($('tabsProyecto-nav') != null){
    	$('tabsProyecto-nav').getElements('a').each(function(i) {
		i.addEvent('click', function(event){
			event.stop();
			//alert(i.get('id'));
			Tab(i.get('id'));
		});
	});
    }
	
});
function Tab(key){
//alert(id + "key " + key);
	$('tabsProyecto-nav').getElements('li').each(function(i) {
		//i.removeClass('active');
		i.set('id','#');
	})
	$(key).getParent().set('id','current');
	
	var req = new Request({
		url: 'views/ProyectoController.php?tab=' + key,
		method: 'get',
		onRequest: function() {
			$('cargando' + '-loading').set('html', '<img src=\'views/img/ajax-loader.gif\' width=\'16\' height=\'16\' alt=\'Loading\' /> Loading...');
		},
		onSuccess: function(responseText) {
			$('cargando' + '-loading').set('html','');
			$('tabs-content').set('html',responseText);
		}
	}).send();
}